\(\int \frac {(2-3 x+x^2) (d+e x+f x^2+g x^3+h x^4)}{4-5 x^2+x^4} \, dx\) [77]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 41, antiderivative size = 66 \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=(f-3 g+7 h) x+\frac {1}{2} (g-3 h) x^2+\frac {h x^3}{3}+(d-e+f-g+h) \log (1+x)-(d-2 e+4 f-8 g+16 h) \log (2+x) \]

[Out]

(f-3*g+7*h)*x+1/2*(g-3*h)*x^2+1/3*h*x^3+(d-e+f-g+h)*ln(1+x)-(d-2*e+4*f-8*g+16*h)*ln(2+x)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.098, Rules used = {1600, 1671, 646, 31} \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=\log (x+1) (d-e+f-g+h)-\log (x+2) (d-2 e+4 f-8 g+16 h)+x (f-3 g+7 h)+\frac {1}{2} x^2 (g-3 h)+\frac {h x^3}{3} \]

[In]

Int[((2 - 3*x + x^2)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(4 - 5*x^2 + x^4),x]

[Out]

(f - 3*g + 7*h)*x + ((g - 3*h)*x^2)/2 + (h*x^3)/3 + (d - e + f - g + h)*Log[1 + x] - (d - 2*e + 4*f - 8*g + 16
*h)*Log[2 + x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 646

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[
(c*d - e*(b/2 - q/2))/q, Int[1/(b/2 - q/2 + c*x), x], x] - Dist[(c*d - e*(b/2 + q/2))/q, Int[1/(b/2 + q/2 + c*
x), x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] && NiceSqrtQ[b^2 - 4*a*
c]

Rule 1600

Int[(u_.)*(Px_)^(p_.)*(Qx_)^(q_.), x_Symbol] :> Int[u*PolynomialQuotient[Px, Qx, x]^p*Qx^(p + q), x] /; FreeQ[
q, x] && PolyQ[Px, x] && PolyQ[Qx, x] && EqQ[PolynomialRemainder[Px, Qx, x], 0] && IntegerQ[p] && LtQ[p*q, 0]

Rule 1671

Int[(Pq_)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[Pq*(a + b*x + c*x^2)^p, x
], x] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rubi steps \begin{align*} \text {integral}& = \int \frac {d+e x+f x^2+g x^3+h x^4}{2+3 x+x^2} \, dx \\ & = \int \left (f-3 g+7 h+(g-3 h) x+h x^2+\frac {d-2 f+6 g-14 h+(e-3 f+7 g-15 h) x}{2+3 x+x^2}\right ) \, dx \\ & = (f-3 g+7 h) x+\frac {1}{2} (g-3 h) x^2+\frac {h x^3}{3}+\int \frac {d-2 f+6 g-14 h+(e-3 f+7 g-15 h) x}{2+3 x+x^2} \, dx \\ & = (f-3 g+7 h) x+\frac {1}{2} (g-3 h) x^2+\frac {h x^3}{3}+(d-e+f-g+h) \int \frac {1}{1+x} \, dx-(d-2 e+4 f-8 g+16 h) \int \frac {1}{2+x} \, dx \\ & = (f-3 g+7 h) x+\frac {1}{2} (g-3 h) x^2+\frac {h x^3}{3}+(d-e+f-g+h) \log (1+x)-(d-2 e+4 f-8 g+16 h) \log (2+x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.02 \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=(f-3 g+7 h) x+\frac {1}{2} (g-3 h) x^2+\frac {h x^3}{3}+(d-e+f-g+h) \log (1+x)+(-d+2 e-4 f+8 g-16 h) \log (2+x) \]

[In]

Integrate[((2 - 3*x + x^2)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(4 - 5*x^2 + x^4),x]

[Out]

(f - 3*g + 7*h)*x + ((g - 3*h)*x^2)/2 + (h*x^3)/3 + (d - e + f - g + h)*Log[1 + x] + (-d + 2*e - 4*f + 8*g - 1
6*h)*Log[2 + x]

Maple [A] (verified)

Time = 0.06 (sec) , antiderivative size = 65, normalized size of antiderivative = 0.98

method result size
norman \(\left (\frac {g}{2}-\frac {3 h}{2}\right ) x^{2}+\left (f -3 g +7 h \right ) x +\frac {h \,x^{3}}{3}+\left (-d +2 e -4 f +8 g -16 h \right ) \ln \left (x +2\right )+\left (d -e +f -g +h \right ) \ln \left (x +1\right )\) \(65\)
default \(\frac {h \,x^{3}}{3}+\frac {g \,x^{2}}{2}-\frac {3 h \,x^{2}}{2}+f x -3 g x +7 h x +\left (-d +2 e -4 f +8 g -16 h \right ) \ln \left (x +2\right )+\left (d -e +f -g +h \right ) \ln \left (x +1\right )\) \(67\)
parallelrisch \(\frac {h \,x^{3}}{3}+\frac {g \,x^{2}}{2}-\frac {3 h \,x^{2}}{2}+f x -3 g x +7 h x +\ln \left (x +1\right ) d -\ln \left (x +1\right ) e +\ln \left (x +1\right ) f -\ln \left (x +1\right ) g +\ln \left (x +1\right ) h -\ln \left (x +2\right ) d +2 \ln \left (x +2\right ) e -4 \ln \left (x +2\right ) f +8 \ln \left (x +2\right ) g -16 \ln \left (x +2\right ) h\) \(98\)
risch \(\frac {h \,x^{3}}{3}+\frac {g \,x^{2}}{2}-\frac {3 h \,x^{2}}{2}+f x -3 g x +7 h x +\ln \left (-x -1\right ) d -\ln \left (-x -1\right ) e +\ln \left (-x -1\right ) f -\ln \left (-x -1\right ) g +\ln \left (-x -1\right ) h -\ln \left (x +2\right ) d +2 \ln \left (x +2\right ) e -4 \ln \left (x +2\right ) f +8 \ln \left (x +2\right ) g -16 \ln \left (x +2\right ) h\) \(108\)

[In]

int((x^2-3*x+2)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x,method=_RETURNVERBOSE)

[Out]

(1/2*g-3/2*h)*x^2+(f-3*g+7*h)*x+1/3*h*x^3+(-d+2*e-4*f+8*g-16*h)*ln(x+2)+(d-e+f-g+h)*ln(x+1)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.94 \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=\frac {1}{3} \, h x^{3} + \frac {1}{2} \, {\left (g - 3 \, h\right )} x^{2} + {\left (f - 3 \, g + 7 \, h\right )} x - {\left (d - 2 \, e + 4 \, f - 8 \, g + 16 \, h\right )} \log \left (x + 2\right ) + {\left (d - e + f - g + h\right )} \log \left (x + 1\right ) \]

[In]

integrate((x^2-3*x+2)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="fricas")

[Out]

1/3*h*x^3 + 1/2*(g - 3*h)*x^2 + (f - 3*g + 7*h)*x - (d - 2*e + 4*f - 8*g + 16*h)*log(x + 2) + (d - e + f - g +
 h)*log(x + 1)

Sympy [A] (verification not implemented)

Time = 0.85 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.42 \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=\frac {h x^{3}}{3} + x^{2} \left (\frac {g}{2} - \frac {3 h}{2}\right ) + x \left (f - 3 g + 7 h\right ) + \left (- d + 2 e - 4 f + 8 g - 16 h\right ) \log {\left (x + \frac {4 d - 6 e + 10 f - 18 g + 34 h}{2 d - 3 e + 5 f - 9 g + 17 h} \right )} + \left (d - e + f - g + h\right ) \log {\left (x + 1 \right )} \]

[In]

integrate((x**2-3*x+2)*(h*x**4+g*x**3+f*x**2+e*x+d)/(x**4-5*x**2+4),x)

[Out]

h*x**3/3 + x**2*(g/2 - 3*h/2) + x*(f - 3*g + 7*h) + (-d + 2*e - 4*f + 8*g - 16*h)*log(x + (4*d - 6*e + 10*f -
18*g + 34*h)/(2*d - 3*e + 5*f - 9*g + 17*h)) + (d - e + f - g + h)*log(x + 1)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.94 \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=\frac {1}{3} \, h x^{3} + \frac {1}{2} \, {\left (g - 3 \, h\right )} x^{2} + {\left (f - 3 \, g + 7 \, h\right )} x - {\left (d - 2 \, e + 4 \, f - 8 \, g + 16 \, h\right )} \log \left (x + 2\right ) + {\left (d - e + f - g + h\right )} \log \left (x + 1\right ) \]

[In]

integrate((x^2-3*x+2)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="maxima")

[Out]

1/3*h*x^3 + 1/2*(g - 3*h)*x^2 + (f - 3*g + 7*h)*x - (d - 2*e + 4*f - 8*g + 16*h)*log(x + 2) + (d - e + f - g +
 h)*log(x + 1)

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.02 \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=\frac {1}{3} \, h x^{3} + \frac {1}{2} \, g x^{2} - \frac {3}{2} \, h x^{2} + f x - 3 \, g x + 7 \, h x - {\left (d - 2 \, e + 4 \, f - 8 \, g + 16 \, h\right )} \log \left ({\left | x + 2 \right |}\right ) + {\left (d - e + f - g + h\right )} \log \left ({\left | x + 1 \right |}\right ) \]

[In]

integrate((x^2-3*x+2)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="giac")

[Out]

1/3*h*x^3 + 1/2*g*x^2 - 3/2*h*x^2 + f*x - 3*g*x + 7*h*x - (d - 2*e + 4*f - 8*g + 16*h)*log(abs(x + 2)) + (d -
e + f - g + h)*log(abs(x + 1))

Mupad [B] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.95 \[ \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx=x^2\,\left (\frac {g}{2}-\frac {3\,h}{2}\right )+x\,\left (f-3\,g+7\,h\right )-\ln \left (x+2\right )\,\left (d-2\,e+4\,f-8\,g+16\,h\right )+\frac {h\,x^3}{3}+\ln \left (x+1\right )\,\left (d-e+f-g+h\right ) \]

[In]

int(((x^2 - 3*x + 2)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(x^4 - 5*x^2 + 4),x)

[Out]

x^2*(g/2 - (3*h)/2) + x*(f - 3*g + 7*h) - log(x + 2)*(d - 2*e + 4*f - 8*g + 16*h) + (h*x^3)/3 + log(x + 1)*(d
- e + f - g + h)